<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <p id="name"></p>
   
    <script>
            function http(url,callback,type="get",){
                $.ajax({
                    url,
                    type,
                    dataType:"json",
                    success:res=>{
                        callback(res)
                    }
                })
            }

            var url="http://localhost:8080/"
            http(url,handleDta);
            console.log(res)
            function handleData(res){
                for(var key in res){
                    var p =document.createElement("p");
                    p.innerHTML=res[key];
                    document.body.append(p)
                }
            }
    </script>
</body>
</html>